package com.gtxy.yyf.doris.controller;


import com.gtxy.yyf.doris.common.core.Result;
import com.gtxy.yyf.doris.mapper.CategoryMapper;
import com.gtxy.yyf.doris.pojo.Category;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;


/**
 * 测试controller
 */

@Controller
@RequestMapping("")
public class CategoryController {

    private static final Logger log= LoggerFactory.getLogger(CategoryController.class);

     @Autowired
     CategoryMapper categoryMapper;

    @GetMapping("/list")
    @ResponseBody
    public Result listDomain(){
        log.info("no:"+"test");
        log.debug("debug"+"test debug");
        log.error("error"+"test debug");
        return Result.success(categoryMapper.findAll()) ;
    }

    @ResponseBody
    @PostMapping("add")
    public Result add(@RequestBody Category order){
        categoryMapper.save(order);
        return Result.success();
    }

    @GetMapping("/test")
    @ResponseBody
    public Result toTest(){
        return Result.success();
    }
}
